<template>
	<view class="equipGoods">
<!-- 		<view class="equipGoodsCard" v-for="(item,index) in props.equipGoods" :key="index" @click="goToEquipDetail(item.equip_id)">
			<image class="main-picture" :src="item.equip_cover_img" mode="aspectFill"></image>
			<view class="footer">
				<text class="equip-title">{{item.equip_title}}</text>
				<view class="price-Browse">
					<text>￥{{item.equip_desplay_price}}</text>
					<view class="Browse">
						<image src="https://img.js.design/assets/img/66f2ab1dc861649a3cabe3c4.png#66ab5a20a50d39f763fbbd8e2eaf50d7" mode=""></image>
						<text>{{item.equip_page_view}}</text>
					</view>
				</view>
			</view>
		</view> -->
		<view class="equipGoodsCard" v-for="(item,index) in 9" :key="index" @click="goToEquipDetail(item.equip_id)">
			<image class="main-picture" src="https://img.js.design/assets/img/66f11effb50663ba27dad125.jpg#8cd4d967c747e623748161d516c5d043" mode="aspectFill"></image>
			<view class="footer">
				<text class="equip-title">这是一个装备</text>
				<view class="price-Browse">
					<text>￥99.9</text>
					<view class="Browse">
						<image src="https://img.js.design/assets/img/66f2ab1dc861649a3cabe3c4.png#66ab5a20a50d39f763fbbd8e2eaf50d7" mode=""></image>
						<text>99</text>
					</view>
				</view>
			</view>
		</view> 
	</view>
</template>

<script setup>
	import { defineProps, watchEffect } from 'vue';
	import {routerGuard} from '@/config/RouteGuard.js'
	const props = defineProps({
		equipGoods: {
			type: Array,
			default: () => []
		}
	});
	
	// 监听 products 的变化
	watchEffect(() => {
		console.log('父组件传递的 equipGoods:', props.equipGoods);
	});
	
	// // 点击卡片，跳转到详情页
	const goToEquipDetail = (id) => {
		const url = `/homeSubpages/equipDetail/equipDetail?equip_id=${id}`;
		routerGuard(url);
	};
</script>

<style lang="scss" scoped>
	.equipGoods{
		display: flex;
		justify-content: space-between;
		align-items: center;
		flex-wrap: wrap;
		gap: 20rpx;
		.equipGoodsCard{
			width: calc((100% - 20rpx) / 2);
			height: 440rpx;
			border-radius: 24rpx;
			background-color: #fff;
			overflow: hidden;
			box-shadow: 0 0 10rpx #eee;
			padding-bottom: 6rpx;
			box-sizing: border-box;
			.main-picture{
				width: 100%;
				height: 300rpx;
			}
			.footer{
				display: flex;
				flex-direction: column;
				gap: 10rpx;
				padding: 0 10rpx;
				box-sizing: border-box;
				.equip-title{
					min-height: 70rpx;
					display: -webkit-box;
					-webkit-box-orient: vertical;
					-webkit-line-clamp: 2;
					overflow: hidden;
					text-overflow: ellipsis;
					font-size: 28rpx;
					font-weight: 400;
				}
				.price-Browse{
					display: flex;
					justify-content: space-between;
					align-items: center;
					gap: 4rpx;
					.price{
						font-size: 28rpx;
						font-weight: 400;
					}
					.Browse{
						display: flex;
						justify-content: space-between;
						align-items: center;
						image{
							width: 40rpx;
							height: 40rpx;
						}
						text{
							font-size: 28rpx;
							font-weight: 400;
							color: rgba(128, 128, 128, 1);
						}
					}
				}
			}
		}
	}
</style>